import { useState } from 'react'
import Taro from '@tarojs/taro'

import { View, Text, Input, ScrollView, Image, Button } from '@tarojs/components'
import './index.scss'

export default function SelectCheck(props) {
    const { renderItem, list = [], active, selectKey = 'value', onChange } = props
    return (
        <View
            catchMove
            onClick={(e) => {
                e.stopPropagation()
            }} className="SelectCheck_box">
            {list.map(val => {
                const { classname, label, value, style = {} } = val
                console.log(val[selectKey])
                return <View onClick={() => { onChange(val) }} className={val[selectKey] === active ? 'SelectCheck_select_info SelectCheck_select_infoCheck' : 'SelectCheck_select_info'}>
                    {renderItem ? renderItem(val) : <View>
                        <View style={style} className={`SelectCheck_select_icon1 ${classname}`}>

                        </View>
                        <View className='SelectCheck_select_font'>
                            {label}
                        </View>
                    </View>}
                </View>
            })}
        </View>
    )
}
